package com.airport.schedule.util;

import java.util.Map;

public class MapUtil {

    public static <T> void normalize(Map<T,Double> map) {
        double sum = 0.0;
        for(double val : map.values()) sum += val;
        if(sum > 0) {
            for (T key : map.keySet()) map.put(key, map.get(key) / sum);
        }
    }

    public static <T> boolean allValuesZero(Map<T, Double> map) {
        for(double val : map.values()) {
            if(val > 0) {
                return false;
            }
        }
        return true;
    }
}
